<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="<%=basePath%>">
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" src="js/tools/jquery-1.4.2.min.js"></script>
<script charset="utf-8" src="js/editor/kindeditor.js"></script>
<style>
table{table-layout:fixed;font-size:12px;}
  tr{background-color:#F1F6F6;}
  td{border:1px solid #D9D9D9;color:black;padding:2px;}
</style>
<script type="text/javascript">
   $(document).ready(function(){
     KE.show({
				id : 'description',
				resizeMode : 1,
				imageUploadJson : '/groupbyajax/brand!uploadImage.action',
				width:'100%',
				height:'500',
				items : [ 'image','justifyleft', 'justifycenter', 'justifyright']
			});
        $.getJSON("groupbyajax/dic!getCategoryList.action",{flag:2},function(data){
        var html="";
           for(var i=0;i<data.category.length;i++)
           {
               html+="<option value='"+data.category[i].id+"'>"+data.category[i].categoryName+"</option>";
           }
          $("#category").html(html);
      });
      var date=new Date();
       $.getJSON("../../groupbyajax/user!getUserCategoryList.action?dateTime="+date.getTime(),{flag:3},function(data)
	     {
	     
	       var category="";
	       for(var i=0;i<data.success.length;i++)
	       {
	         category+="<option value='"+data.success[i].id+"'>"+data.success[i].categoryName+"</option>";
	       }
	      
	         $("#category2").html(category);
	     });
   });
   function startSubmit()
   {
     var brandName=$("input[name='brandName']").val();
     var description=$("#description").val();
     
     if(brandName.length<1||brandName.length>100)
     {
         alert("品牌标题的字数在1~100之间!");
         return false;
     }
     if(description.length>3000)
     {
        alert("相册描述不能大于3000!");
         return false;
     }
     if(description.indexOf('img')==-1)
     {
        alert("至少添加一张图片!");
        return false;
     }
     return true;
   }
   
			
          
		</script>
</script>
</head>
<body>
 <form action="admin/user/branduser!addBrandInfor.action" method="post" onsubmit="return startSubmit();">
 <table  style="width:80%;" align="center">
  <tr><td  align="center"><s:actionerror/></td></tr>
 <tr><td align="center"><font size=5>添加资讯</font></td></tr>
 <tr><td>标题:</td></tr>
 <tr><td><input type="text" name="brandName"></td></tr>
 <tr><td>分类1：<select name="category2" id="category2"></select></td></tr>
 <tr><td>分类2：<select name="category" id="category"></select></td></tr>
 <tr><td>正文:</td></tr>
 <tr><td><textarea  name="description" id="description"></textarea>  </td></tr>

<tr>
    <td  align="center">
       <input type="submit" value="添加">
    </td>
</tr>
</table>
</form>
</body>
</html>